var entityCollection = require('../../../Base/server/controllers/EntityCollection');

//查找检验标准
exports.findQCStandard = function(itemMasterId, workId, completeFun){
    var qcStandardEntity = entityCollection.getEntity("QCStandard");
    qcStandardEntity.find({ItemMaster: itemMasterId, Work: workId}, null, 
        {
            path: 'QCNorm', 
            populate: {
                path: 'ExtendEnum',
                select: 'Code Name',
                model: 'ExtendEnum'
            }
        }, 
        function(err, records){
            if(err){
                var newErr = new Error();
                newErr.leval = 9;
                newErr.title = '查询检验标准错误';
                newErr.message = '查询失败，请检查查询参数！';
                completeFun(newErr);
            }
            else{
                completeFun(null, records);
            }
        }
    );
};